This report uses IRC’s monitoring data to present a summary of the program implementation and overall compliance.
Code
# Mainly use irc monitoring datairc_monitoring <-read_dta("reBuild_Kenya/DataConstruction/2_build/irc_monitoring.dta") %>%select(caseid, site, treatment2, control_status, treatment, total_payments, all_payments_count, all_payments_types, contains("payment_date"), contains("payment_type"), day) %>%# We create a treated variable for people considered treated/enrolled/compliant by the IRCmutate(treated =case_when(treatment2 ==4& control_status!=1~0,.default =1)) %>%# We clean the infosession dates : the Kawangware and Pangani dates are recorded as 2023 instead of 2022mutate(infosesh_date =case_when(site ==2~ day -365, #Kawangware site ==1~ day -365, #Pangani.default = day)) %>%select(-day)# Read in panel datafinal_panel <-read_dta("reBuild_Kenya/DataConstruction/2_build/final_panel.dta") %>%filter(obs ==1) # Only keep observed rows# Read in registration dataregistration_date <-read_dta("reBuild_Kenya/DataConstruction/2_build/registration.date.dta")
Code
## Clean the final panel datafinal_panel_clean <- final_panel %>%select(caseid, cohort, gender, mentee, refugee, starttime, treat_assignment, final_assignment, obs, panel_round)## Transform into date formatfinal_panel_clean$starttime <-as.character(final_panel_clean$starttime) # Make sure it's characterfinal_panel_clean$startdate_only <-sub(" .*", "", final_panel_clean$starttime) # Delete everything after the spacefinal_panel_clean$startdate_only <-as.Date(final_panel_clean$startdate_only, format ="%Y-%m-%d") # Transform into date format# Transform panel data from long to wide# Every row is unique caseidfinal_panel_wide <- final_panel_clean %>%pivot_wider(names_from = panel_round, values_from = startdate_only,id_cols =c(caseid, cohort, gender, mentee, refugee, treat_assignment, final_assignment, obs)) %>%rename(Baseline_startdate ="1",FU1_startdate ="2",MID3_startdate ="3",MID6_startdate ="4",END9_startdate ="5" )## Add a treatment-treated-control variable to the final panel final_panel_wide <- final_panel_wide %>%#add the monitoring data to determine treated statusleft_join(irc_monitoring, by ="caseid") %>%#if an observation isn't in the monitoring data, it is untreatedmutate(treated =case_when(is.na(treated) ~0,.default = treated),#create three groups: control, untreated, treated (default)group =case_when(treat_assignment ==0~3, treat_assignment !=0& treated ==0~2,.default =1),#create the demographic breakdown variabledemo =case_when(gender =="Male"& refugee ==0~1, gender =="Female"& refugee ==0~2, gender =="Male"& refugee ==1~3, gender =="Female"& refugee ==1~4),female =case_when(gender =="Male"~0, gender =="Female"~1))## Append registration date to the final panelfinal_panel_wide <- final_panel_wide %>%left_join(registration_date, by ="caseid")final_panel_wide$Fullregistrationdate =as.Date(final_panel_wide$Fullregistrationdate, format ="%Y-%m-%d")## Store the group and demographic labels for graph labelinggrouplabels <-c("Treated", "Untreated", "Control")demolabels <-c("Male Host", "Female Host", "Male Refugee", "Female Refugee")femalelabels <-c("Male", "Female")refugeelabels <-c("Host", "Refugee")# treatment2: 1 = Cash, 2 = BC, 3 = PS, 4 = control
Program Compliance
Below, we define compliance as being considered enrolled in the program by IRC, aka having showed up for the initial info session required to start programming. From the perspective of the control group, being non-compliant means not having picked up the assignment call.
Code
# Seperate mentee and mentor Mentee datafinal_panel_wide_mentee <- final_panel_wide %>%filter(mentee ==1) %>%group_by(final_assignment, treated) %>%count() %>%group_by(final_assignment) %>%mutate(total_n =sum(n), percentage =round((n/total_n) *100, 2)) %>%mutate(percentage =paste0(percentage, "%")) %>%filter(treated ==1) %>%select(final_assignment, total_n, n, percentage)# Mentor datafinal_panel_wide_mentor <- final_panel_wide %>%filter(mentee ==0) %>%group_by(final_assignment, treated) %>%count() %>%group_by(final_assignment) %>%mutate(total_n =sum(n), percentage =round((n/total_n) *100, 2)) %>%mutate(percentage =paste0(percentage, "%")) %>%filter(treated ==1) %>%select(final_assignment, total_n, n, percentage)## Mentee Table Set up row names and column namesrownames(final_panel_wide_mentee) <-c("Cash", "Business Content", "Perspective Sharing","Control")final_panel_wide_mentee$final_assignment <-rownames(final_panel_wide_mentee)colnames(final_panel_wide_mentee) <-c("Assignment", "N Assigned", "N Compliant","% Compliant")# Use kable to create a table with the resultskable(final_panel_wide_mentee, format ="html", caption ="Compliant Mentees", row.names =FALSE) %>%kable_styling(font_size =9, full_width = F, bootstrap_options =c("striped")) %>%column_spec(1, width ="3cm") %>%column_spec(2, width ="2cm")## Mentor Table Set up row names and column namesrownames(final_panel_wide_mentor) <-c("Business Content", "Perspective Sharing","Control")final_panel_wide_mentor$final_assignment <-rownames(final_panel_wide_mentor)colnames(final_panel_wide_mentor) <-c("Assignment", "N Assigned", "N Compliant","% Compliant")# Use kable to create a table with the resultskable(final_panel_wide_mentor, format ="html", caption ="Compliant Mentors", row.names =FALSE) %>%kable_styling(font_size =9, full_width = F, bootstrap_options =c("striped")) %>%column_spec(1, width ="3cm") %>%column_spec(2, width ="2cm")
Compliant Mentees
Assignment
N Assigned
N Compliant
% Compliant
Cash
606
569
93.89%
Business Content
400
388
97%
Perspective Sharing
398
389
97.74%
Control
619
589
95.15%
Compliant Mentors
Assignment
N Assigned
N Compliant
% Compliant
Business Content
611
579
94.76%
Perspective Sharing
656
595
90.7%
Control
635
589
92.76%
Payments Compliance
In this section, we look at compliance with the planned payments scheduled, limiting the sample to people who looking at the people officially as per the IRC
Code
## Mentee Payment## Show business grant only for menteesmentee_payment <- final_panel_wide %>%filter(treated ==1, # Filter to active treatment arms only mentee ==1, # Filter to mentee only final_assignment !='control') %>%# Filter to people who get treatmentmutate(receive_any_payment =ifelse(total_payments >0, 1, 0),business_grant =ifelse(str_detect(all_payments_types, "business_grant"), 1, 0) ) %>%group_by(final_assignment) %>%summarize(num =n(),num_receive_any_payment =sum(receive_any_payment),num_business_grant =sum(business_grant),percent_receive_any_payment =round((num_receive_any_payment / num) *100, 2),percent_business_grant =round((num_business_grant / num) *100, 2),average_num_payments =round(mean(all_payments_count, na.rm =TRUE),2),average_amount_payments =round(mean(total_payments, na.rm =TRUE),2) ) %>%select(final_assignment, num, percent_receive_any_payment, percent_business_grant, average_num_payments, average_amount_payments)## Mentor Paymentmentor_payment <- final_panel_wide %>%filter(treated ==1, # Filter to active treatment arms only mentee ==0, # Filter to mentor only final_assignment !='control') %>%# Filter to people who get treatmentmutate(receive_any_payment =ifelse(total_payments >0, 1, 0) ) %>%group_by(final_assignment) %>%summarize(num =n(),num_receive_any_payment =sum(receive_any_payment),percent_receive_any_payment =round((num_receive_any_payment / num) *100, 2),average_num_payments =round(mean(all_payments_count, na.rm =TRUE),2),average_amount_payments =round(mean(total_payments, na.rm =TRUE),2) ) %>%select(final_assignment, num, percent_receive_any_payment, average_num_payments, average_amount_payments)
Code
## Mentee Payment Table Set up row names and column namesrownames(mentee_payment) <-c("Business Content", "Cash", "Perspective Sharing")mentee_payment$final_assignment <-rownames(mentee_payment)colnames(mentee_payment) <-c("Assignment", "N", "% got any payment", "% got business grant","Average number of payments received", "Average total amount received (KES)")# Use kable to create a table with the resultskable(mentee_payment, format ="html", caption ="Mentees Payment", row.names =FALSE) %>%kable_styling(font_size =9, full_width = F, bootstrap_options =c("striped")) %>%column_spec(1, width ="3cm") %>%column_spec(2, width ="2cm") %>%column_spec(3, width ="2cm") %>%column_spec(4, width ="2cm") %>%column_spec(5, width ="2cm") %>%column_spec(6, width ="2cm")## Mentor Table Set up row names and column namesrownames(mentor_payment) <-c("Business Content", "Perspective Sharing")mentor_payment$final_assignment <-rownames(mentor_payment)colnames(mentor_payment) <-c("Assignment", "N", "% got any payment", "Average number of payments received","Average total amount received (KES)")# Use kable to create a table with the resultskable(mentor_payment, format ="html", caption ="Mentors Payment", row.names =FALSE) %>%kable_styling(font_size =9, full_width = F, bootstrap_options =c("striped")) %>%column_spec(1, width ="3cm") %>%column_spec(2, width ="2cm") %>%column_spec(3, width ="2cm") %>%column_spec(4, width ="2cm") %>%column_spec(5, width ="2cm")
Mentees Payment
Assignment
N
% got any payment
% got business grant
Average number of payments received
Average total amount received (KES)
Business Content
569
100
99.47
4.27
59887.17
Cash
388
100
100.00
1.98
56397.94
Perspective Sharing
589
100
100.00
4.26
60068.93
Mentors Payment
Assignment
N
% got any payment
Average number of payments received
Average total amount received (KES)
Business Content
579
100
3.24
25242.14
Perspective Sharing
589
100
3.25
25343.29
Study Milestones Timeline
Code
# Calculate for each survey round the distance to baseline (in days)# Calculate the distance between registration and baseline (in days, should be negative)final_panel_wide <- final_panel_wide %>%mutate(distance_to_baseline_fu1 =as.numeric(as.Date(FU1_startdate) -as.Date(Baseline_startdate)),distance_to_baseline_mid3 =as.numeric(as.Date(MID3_startdate) -as.Date(Baseline_startdate)),distance_to_baseline_mid6 =as.numeric(as.Date(MID6_startdate) -as.Date(Baseline_startdate)),distance_to_baseline_end9 =as.numeric(as.Date(END9_startdate) -as.Date(Baseline_startdate)),distance_to_baseline_reg =as.numeric(as.Date(Fullregistrationdate) -as.Date(Baseline_startdate)),## Check if it is NA distance_to_baseline_fu1 =ifelse(distance_to_baseline_fu1 <0, NA, distance_to_baseline_fu1),distance_to_baseline_mid3 =ifelse(distance_to_baseline_mid3 <0, NA, distance_to_baseline_mid3),distance_to_baseline_mid6 =ifelse(distance_to_baseline_mid6 <0, NA, distance_to_baseline_mid6),distance_to_baseline_end9 =ifelse(distance_to_baseline_end9 <0, NA, distance_to_baseline_end9) )final_panel_wide <- final_panel_wide %>%mutate(across(starts_with("payment_date_"), as.Date)) %>%# Convert to datemutate(first_payment_date =pmin(payment_date_1, payment_date_2, payment_date_3, payment_date_4, payment_date_5, payment_date_6, payment_date_7, na.rm =TRUE),last_payment_date =pmax(payment_date_1, payment_date_2, payment_date_3, payment_date_4, payment_date_5, payment_date_6, payment_date_7, na.rm =TRUE) )
Code
# Find the business grant payment dates# Check from payment_type_1 to payment_type_7 if it is business grant, find the payment date sharing the same suffixfinal_panel_wide <- final_panel_wide %>%# Find business grant payment datesmutate(# Assuming "business_grant" is the exact phrase to match in payment_type columnsbusiness_grant_dates =pmin(case_when(payment_type_1 =="business_grant"~ payment_date_1, TRUE~as.Date(NA)),case_when(payment_type_2 =="business_grant"~ payment_date_2, TRUE~as.Date(NA)),case_when(payment_type_3 =="business_grant"~ payment_date_3, TRUE~as.Date(NA)),case_when(payment_type_4 =="business_grant"~ payment_date_4, TRUE~as.Date(NA)),case_when(payment_type_5 =="business_grant"~ payment_date_5, TRUE~as.Date(NA)),case_when(payment_type_6 =="business_grant"~ payment_date_6, TRUE~as.Date(NA)),case_when(payment_type_7 =="business_grant"~ payment_date_7, TRUE~as.Date(NA)),na.rm =TRUE ) )# Add time to business grant payment final_panel_wide <- final_panel_wide %>%mutate(distance_to_bizgrant_reg =as.numeric(as.Date(Fullregistrationdate) -as.Date(business_grant_dates)),distance_to_bizgrant_base =as.numeric(as.Date(Baseline_startdate) -as.Date(business_grant_dates)),distance_to_bizgrant_fu1 =as.numeric(as.Date(FU1_startdate) -as.Date(business_grant_dates)),distance_to_bizgrant_mid3 =as.numeric(as.Date(MID3_startdate) -as.Date(business_grant_dates)),distance_to_bizgrant_mid6 =as.numeric(as.Date(MID6_startdate) -as.Date(business_grant_dates)),distance_to_bizgrant_end9 =as.numeric(as.Date(END9_startdate) -as.Date(business_grant_dates)), )# Add time to info sessionfinal_panel_wide <- final_panel_wide %>%mutate(distance_to_infosesh_reg =as.numeric(as.Date(Fullregistrationdate) -as.Date(infosesh_date)),distance_to_infosesh_base =as.numeric(as.Date(Baseline_startdate) -as.Date(infosesh_date)),distance_to_infosesh_fu1 =as.numeric(as.Date(FU1_startdate) -as.Date(infosesh_date)),distance_to_infosesh_mid3 =as.numeric(as.Date(MID3_startdate) -as.Date(infosesh_date)),distance_to_infosesh_mid6 =as.numeric(as.Date(MID6_startdate) -as.Date(infosesh_date)),distance_to_infosesh_end9 =as.numeric(as.Date(END9_startdate) -as.Date(infosesh_date)), )# Add distance to baseline for bizgrant and infosession to add to the main timeline graphfinal_panel_wide <- final_panel_wide %>%mutate(distance_to_baseline_bizgrant =as.numeric(as.Date(business_grant_dates) -as.Date(Baseline_startdate)),distance_to_baseline_infosesh =as.numeric(as.Date(infosesh_date) -as.Date(Baseline_startdate)) )
# Plot the average over time of each round | layout: true | .widths: [50, 50] |# .heights: [50, 50] Use line graph to show the average distance to baseline# over time, different lines for different cohorts Use# distance_to_baseline_fu1, distance_to_baseline_mid3,# distance_to_baseline_mid6, distance_to_baseline_end9 Use the average of each# round# Transform 'cohort' to factorfinal_panel_wide$cohort <-as_factor(final_panel_wide$cohort)final_panel_wide_mentee_timeline <- final_panel_wide %>%filter(mentee ==1) %>%group_by(cohort, refugee) %>%summarize(avg_distance_to_baseline_reg =mean(distance_to_baseline_reg, na.rm =TRUE),avg_distance_to_baseline_fu1 =mean(distance_to_baseline_fu1, na.rm =TRUE),avg_distance_to_baseline_mid3 =mean(distance_to_baseline_mid3, na.rm =TRUE),avg_distance_to_baseline_mid6 =mean(distance_to_baseline_mid6, na.rm =TRUE),avg_distance_to_baseline_end9 =mean(distance_to_baseline_end9, na.rm =TRUE),avg_distance_to_baseline_bizgrant =mean(distance_to_baseline_bizgrant, na.rm =TRUE),avg_distance_to_baseline_infosesh =mean(distance_to_baseline_infosesh, na.rm =TRUE),.groups ="drop") %>%pivot_longer(cols =starts_with("avg_distance_to_baseline_"), names_to ="round",values_to ="avg_distance_to_baseline")final_panel_wide_mentee_timeline$round <-fct_relevel(final_panel_wide_mentee_timeline$round,"avg_distance_to_baseline_reg", "avg_distance_to_baseline_base", "avg_distance_to_baseline_infosesh","avg_distance_to_baseline_fu1", "avg_distance_to_baseline_bizgrant", "avg_distance_to_baseline_mid3","avg_distance_to_baseline_mid6", "avg_distance_to_baseline_end9")# Mentee Timeline Plot Seperate by refugee or hostfinal_panel_wide_mentee_timeline %>%mutate(refugee =ifelse(refugee ==1, "Refugee", "Host")) %>%ggplot(aes(x = round, y = avg_distance_to_baseline, color = cohort, group = cohort)) +geom_point() +geom_line() +coord_flip() +labs(x ="Round", y ="Average distance to baseline (in days)",title ="Average distance to baseline over time(Mentee)", subtitle ="Average distance to baseline over time, shown by cohort") +scale_x_discrete(labels =c("Registration", "Info Session", "Follow-up 1", "Business Grant","Midline 3", "Midline 6", "Endline 9")) +geom_hline(yintercept =0, linetype ="dashed",color ="red") +theme_minimal() +facet_wrap(~refugee)
Code
# Plot the average over time of each round | layout: true | .widths: [50, 50] |# .heights: [50, 50]final_panel_wide_mentor_timeline <- final_panel_wide %>%filter(mentee ==0) %>%group_by(cohort, refugee) %>%summarize(avg_distance_to_baseline_reg =mean(distance_to_baseline_reg, na.rm =TRUE),avg_distance_to_baseline_fu1 =mean(distance_to_baseline_fu1, na.rm =TRUE),avg_distance_to_baseline_mid3 =mean(distance_to_baseline_mid3, na.rm =TRUE),avg_distance_to_baseline_mid6 =mean(distance_to_baseline_mid6, na.rm =TRUE),avg_distance_to_baseline_end9 =mean(distance_to_baseline_end9, na.rm =TRUE),avg_distance_to_baseline_infosesh =mean(distance_to_baseline_infosesh, na.rm =TRUE),.groups ="drop") %>%pivot_longer(cols =starts_with("avg_distance_to_baseline_"), names_to ="round",values_to ="avg_distance_to_baseline")final_panel_wide_mentor_timeline$round <-fct_relevel(final_panel_wide_mentor_timeline$round,"avg_distance_to_baseline_reg", "avg_distance_to_baseline_base", "avg_distance_to_baseline_infosesh","avg_distance_to_baseline_fu1", "avg_distance_to_baseline_mid3", "avg_distance_to_baseline_mid6","avg_distance_to_baseline_end9")# Mentor Timeline Plotfinal_panel_wide_mentor_timeline %>%mutate(refugee =ifelse(refugee ==1, "Refugee", "Host")) %>%ggplot(aes(x = round, y = avg_distance_to_baseline, color = cohort, group = cohort)) +geom_point() +geom_line() +coord_flip() +labs(x ="Round", y ="Average distance to baseline (in days)",title ="Average distance to baseline over time(Mentor)", subtitle ="Average distance to baseline over time, shown by cohort") +scale_x_discrete(labels =c("Registration", "Info Session", "Follow-up 1", "Midline 3","Midline 6", "Endline 9")) +geom_hline(yintercept =0, linetype ="dashed",color ="red") +theme_minimal() +facet_wrap(~refugee)
# Plot the average over time of each round | layout: true | .widths: [50, 50] |# .heights: [50, 50] Use line graph to show the average distance to baseline# over time, different lines for different treatment arms# Transform 'final_assignment' to factorfinal_panel_wide$final_assignment <-as_factor(final_panel_wide$final_assignment)final_panel_wide_mentee_timeline_arm <- final_panel_wide %>%filter(mentee ==1, final_assignment !="control") %>%group_by(final_assignment) %>%summarize(avg_distance_to_baseline_reg =mean(distance_to_baseline_reg, na.rm =TRUE),avg_distance_to_baseline_fu1 =mean(distance_to_baseline_fu1, na.rm =TRUE),avg_distance_to_baseline_mid3 =mean(distance_to_baseline_mid3, na.rm =TRUE),avg_distance_to_baseline_mid6 =mean(distance_to_baseline_mid6, na.rm =TRUE),avg_distance_to_baseline_end9 =mean(distance_to_baseline_end9, na.rm =TRUE),avg_distance_to_baseline_bizgrant =mean(distance_to_baseline_bizgrant, na.rm =TRUE),avg_distance_to_baseline_infosesh =mean(distance_to_baseline_infosesh, na.rm =TRUE),.groups ="drop") %>%pivot_longer(cols =starts_with("avg_distance_to_baseline_"), names_to ="round",values_to ="avg_distance_to_baseline")final_panel_wide_mentee_timeline_arm$round <-fct_relevel(final_panel_wide_mentee_timeline_arm$round,"avg_distance_to_baseline_reg", "avg_distance_to_baseline_base", "avg_distance_to_baseline_infosesh","avg_distance_to_baseline_fu1", "avg_distance_to_baseline_bizgrant", "avg_distance_to_baseline_mid3","avg_distance_to_baseline_mid6", "avg_distance_to_baseline_end9")# Mentee Timeline Plot Seperate by active treatment armfinal_panel_wide_mentee_timeline_arm %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", ifelse(final_assignment =="cash", "Cash", final_assignment)))) %>%ggplot(aes(x = round, y = avg_distance_to_baseline, color = final_assignment,group = final_assignment)) +geom_point() +geom_line() +coord_flip() +labs(x ="Round", y ="Average distance to baseline (in days)", title ="Average distance to baseline over time(Mentee)",subtitle ="Average distance to baseline over time, shown by active treatment arm") +scale_x_discrete(labels =c("Registration", "Info Session", "Follow-up 1", "Business Grant","Midline 3", "Midline 6", "Endline 9")) +geom_hline(yintercept =0, linetype ="dashed",color ="red") +theme_minimal()
Code
# Plot the average over time of each round | layout: true | .widths: [50, 50] |# .heights: [50, 50]# Use line graph to show the average distance to baseline over time, different# lines for different treatment armsfinal_panel_wide_mentor_timeline_arm <- final_panel_wide %>%filter(mentee ==0, final_assignment !="control") %>%group_by(final_assignment) %>%summarize(avg_distance_to_baseline_reg =mean(distance_to_baseline_reg, na.rm =TRUE),avg_distance_to_baseline_fu1 =mean(distance_to_baseline_fu1, na.rm =TRUE),avg_distance_to_baseline_mid3 =mean(distance_to_baseline_mid3, na.rm =TRUE),avg_distance_to_baseline_mid6 =mean(distance_to_baseline_mid6, na.rm =TRUE),avg_distance_to_baseline_end9 =mean(distance_to_baseline_end9, na.rm =TRUE),avg_distance_to_baseline_infosesh =mean(distance_to_baseline_infosesh, na.rm =TRUE),.groups ="drop") %>%pivot_longer(cols =starts_with("avg_distance_to_baseline_"), names_to ="round",values_to ="avg_distance_to_baseline")final_panel_wide_mentor_timeline_arm$round <-fct_relevel(final_panel_wide_mentor_timeline_arm$round,"avg_distance_to_baseline_reg", "avg_distance_to_baseline_base", "avg_distance_to_baseline_infosesh","avg_distance_to_baseline_fu1", "avg_distance_to_baseline_mid3", "avg_distance_to_baseline_mid6","avg_distance_to_baseline_end9")# Mentee Timeline Plot Seperate by active treatment armfinal_panel_wide_mentor_timeline_arm %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", final_assignment))) %>%ggplot(aes(x = round, y = avg_distance_to_baseline, color = final_assignment,group = final_assignment)) +geom_point() +geom_line() +coord_flip() +labs(x ="Round", y ="Average distance to baseline (in days)", title ="Average distance to baseline over time(Mentor)",subtitle ="Average distance to baseline over time, shown by active treatment arm") +scale_x_discrete(labels =c("Registration", "Info Session", "Follow-up 1", "Midline 3","Midline 6", "Endline 9")) +geom_hline(yintercept =0, linetype ="dashed",color ="red") +theme_minimal()
# Use boxplot to plot the range over time of each round Use# distance_to_baseline_fu1, distance_to_baseline_mid3,# distance_to_baseline_mid6, distance_to_baseline_end9final_panel_long_mentee_timerange <- final_panel_wide %>%filter(mentee ==1) %>%group_by(refugee, cohort) %>%pivot_longer(cols =starts_with("distance_to_baseline_"), names_to ="round",values_to ="distance_to_baseline") %>%mutate(round =factor(round, levels =c("distance_to_baseline_reg", "distance_to_baseline_infosesh","distance_to_baseline_fu1", "distance_to_baseline_bizgrant", "distance_to_baseline_mid3","distance_to_baseline_mid6", "distance_to_baseline_end9")))
Code
# Plot the boxplotfinal_panel_long_mentee_timerange %>%filter(refugee ==1) %>%ggplot(aes(x = round, y = distance_to_baseline, color = cohort)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)", title ="Range of distance to baseline over time(Mentee Refugee)",subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0,linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Business Grant", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Code
# Plot the boxplotfinal_panel_long_mentee_timerange %>%filter(refugee ==0) %>%ggplot(aes(x = round, y = distance_to_baseline, color = cohort)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)", title ="Range of distance to baseline over time(Mentee Host)",subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0,linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Business Grant", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Code
final_panel_long_mentor_timerange <- final_panel_wide %>%filter(mentee ==0) %>%# remove the distance to baseline bizgrant var to avoid creating NAs when# pivotingselect(-distance_to_baseline_bizgrant) %>%group_by(refugee, cohort) %>%pivot_longer(cols =starts_with("distance_to_baseline_"), names_to ="round",values_to ="distance_to_baseline") %>%mutate(round =factor(round, levels =c("distance_to_baseline_reg", "distance_to_baseline_infosesh","distance_to_baseline_fu1", "distance_to_baseline_mid3", "distance_to_baseline_mid6","distance_to_baseline_end9")))final_panel_long_mentor_timerange %>%filter(refugee ==0) %>%ggplot(aes(x = round, y = distance_to_baseline, color = cohort)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)", title ="Range of distance to baseline over time(Mentor Host)",subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0,linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
# Use boxplot to plot the range over time of each round Use# distance_to_baseline_fu1, distance_to_baseline_mid3,# distance_to_baseline_mid6, distance_to_baseline_end9final_panel_long_mentee_timerange_arm <- final_panel_wide %>%filter(mentee ==1) %>%group_by(refugee, final_assignment) %>%pivot_longer(cols =starts_with("distance_to_baseline_"), names_to ="round",values_to ="distance_to_baseline") %>%mutate(round =factor(round, levels =c("distance_to_baseline_reg", "distance_to_baseline_infosesh","distance_to_baseline_fu1", "distance_to_baseline_bizgrant", "distance_to_baseline_mid3","distance_to_baseline_mid6", "distance_to_baseline_end9")))
Code
# Plot the boxplotfinal_panel_long_mentee_timerange_arm %>%filter(refugee ==1, final_assignment !="control") %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", ifelse(final_assignment =="cash", "Cash", final_assignment)))) %>%ggplot(aes(x = round, y = distance_to_baseline, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)",title ="Range of distance to baseline over time(Mentee Refugee)", subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Business Grant", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Code
# Plot the boxplotfinal_panel_long_mentee_timerange_arm %>%filter(refugee ==0, final_assignment !="control") %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", ifelse(final_assignment =="cash", "Cash", final_assignment)))) %>%ggplot(aes(x = round, y = distance_to_baseline, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)",title ="Range of distance to baseline over time(Mentee Host)", subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Business Grant", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Code
final_panel_long_mentor_timerange_arm <- final_panel_wide %>%filter(mentee ==0) %>%# remove the distance to baseline bizgrant var to avoid creating NAs when# pivotingselect(-distance_to_baseline_bizgrant) %>%group_by(refugee, final_assignment) %>%pivot_longer(cols =starts_with("distance_to_baseline_"), names_to ="round",values_to ="distance_to_baseline") %>%mutate(round =factor(round, levels =c("distance_to_baseline_reg", "distance_to_baseline_infosesh","distance_to_baseline_fu1", "distance_to_baseline_mid3", "distance_to_baseline_mid6","distance_to_baseline_end9")))final_panel_long_mentor_timerange_arm %>%filter(refugee ==0, final_assignment !="control") %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", final_assignment))) %>%ggplot(aes(x = round, y = distance_to_baseline, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to baseline (in days)",title ="Range of distance to baseline over time(Mentor Host)", subtitle ="Each round's distance to baseline") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Payments Time Range
Payment Time Range by cohort
Mentee Business Grant Payment Time Range
Code
## 1.Active Treatment Arms## 2. ## Calculate distance to baseline for first, last, business grant payment datesfinal_panel_wide <- final_panel_wide %>%mutate(distance_to_baseline_first =as.numeric(as.Date(first_payment_date) -as.Date(Baseline_startdate)),distance_to_baseline_last =as.numeric(as.Date(last_payment_date) -as.Date(Baseline_startdate)),distance_to_baseline_grant =as.numeric(as.Date(business_grant_dates) -as.Date(Baseline_startdate)),## Check if it is NA distance_to_baseline_last =ifelse(distance_to_baseline_last <0, NA, distance_to_baseline_last),distance_to_baseline_grant =ifelse(distance_to_baseline_grant <0, NA, distance_to_baseline_grant) )final_panel_wide %>%filter(mentee ==1) %>%mutate(refugee =ifelse(refugee ==1, "Refugee", "Host") ) %>%ggplot(aes(y = distance_to_baseline_grant, color = cohort)) +geom_boxplot() +coord_flip() +labs(y ="Distance to baseline for Business Grant Payment (in days)",title ="Businee Grant Payment's distance to baseline",subtitle ="Range of distance to baseline over time for business grant payment(Mentee)" ) +scale_x_discrete(labels =c("Business Grant Payment") ) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) +# Rotate x-axis labelsfacet_wrap(~refugee, nrow =2)
Mentor First and Last Payment Time Range
Code
final_panel_wide %>%filter(mentee ==0) %>%group_by(refugee, cohort) %>%pivot_longer(cols =c("distance_to_baseline_first", "distance_to_baseline_last"),names_to ="first_last", values_to ="distance_to_baseline_first_last") %>%mutate(first_last =factor(first_last, levels =c("distance_to_baseline_first","distance_to_baseline_last"))) %>%ggplot(aes(x = first_last, y = distance_to_baseline_first_last, color = cohort)) +geom_boxplot() +coord_flip() +labs(x ="First and Last Payment", y ="Distance to baseline (in days)",title ="First and Last Payment's distance to baseline", subtitle ="Range of distance to baseline over time for first and last payments(Mentor Host)") +scale_x_discrete(labels =c("First Payment", "Last Payment")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Payment Time Range by Active Treatment Arm
Mentee Business Grant Payment Time Range
Code
final_panel_wide %>%filter(mentee ==1, final_assignment !='control') %>%mutate(refugee =ifelse(refugee ==1, "Refugee", "Host"),final_assignment =ifelse( final_assignment =="bc","Business Content",ifelse( final_assignment =="pg","Perspective Sharing",ifelse( final_assignment =="cash","Cash", final_assignment ) ) ) ) %>%ggplot(aes(y = distance_to_baseline_grant, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(y ="Distance to baseline for Business Grant Payment (in days)",title ="Businee Grant Payment's distance to baseline",subtitle ="Range of distance to baseline over time for business grant payment(Mentee)" ) +scale_x_discrete(labels =c("Business Grant Payment") ) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) +# Rotate x-axis labelsfacet_wrap(~refugee, nrow =2)
Mentor First and Last Payment Time Range
Code
final_panel_wide %>%filter(mentee ==0, final_assignment !="control") %>%group_by(refugee, final_assignment) %>%pivot_longer(cols =c("distance_to_baseline_first", "distance_to_baseline_last"),names_to ="first_last", values_to ="distance_to_baseline_first_last") %>%mutate(first_last =factor(first_last, levels =c("distance_to_baseline_first","distance_to_baseline_last")), final_assignment =ifelse(final_assignment =="bc", "Business Content", ifelse(final_assignment =="pg", "Perspective Sharing", final_assignment))) %>%ggplot(aes(x = first_last, y = distance_to_baseline_first_last, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="First and Last Payment", y ="Distance to baseline (in days)",title ="First and Last Payment's distance to baseline", subtitle ="Range of distance to baseline over time for first and last payments(Mentor Host)") +scale_x_discrete(labels =c("First Payment", "Last Payment")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
# Use boxplot to plot the range over time of each roundexposure_mentees_infosesh <- final_panel_wide %>%filter(mentee ==1, final_assignment !="control") %>%group_by(final_assignment) %>%pivot_longer(cols =starts_with("distance_to_infosesh_"), names_to ="round",values_to ="distance_to_infosesh") %>%mutate(round =factor(round, levels =c("distance_to_infosesh_reg", "distance_to_infosesh_base","distance_to_infosesh_fu1", "distance_to_infosesh_mid3", "distance_to_infosesh_mid6","distance_to_infosesh_end9")))
Code
# Plot the boxplotexposure_mentees_infosesh %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", ifelse(final_assignment =="cash", "Cash", final_assignment)))) %>%ggplot(aes(x = round, y = distance_to_infosesh, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to info session (in days)",title ="Range of distance to info session over time (Mentees)", subtitle ="Each round's distance to info session") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Baseline", "Follow-up 1", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Code
exposure_mentors_infosesh <- final_panel_wide %>%filter(mentee ==0, final_assignment !="control") %>%group_by(final_assignment) %>%pivot_longer(cols =starts_with("distance_to_infosesh_"), names_to ="round",values_to ="distance_to_infosesh") %>%mutate(round =factor(round, levels =c("distance_to_infosesh_reg", "distance_to_infosesh_base","distance_to_infosesh_fu1", "distance_to_infosesh_mid3", "distance_to_infosesh_mid6","distance_to_infosesh_end9")))exposure_mentors_infosesh %>%filter(final_assignment !="control") %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", final_assignment))) %>%ggplot(aes(x = round, y = distance_to_infosesh, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to info session (in days)",title ="Range of distance to info session over time (Mentor)", subtitle ="Each round's distance to info session") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Info Session", "Follow-up 1", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels
Exposure since Business Grant (Mentees)
Code
# Use boxplot to plot the range over time of each roundexposure_mentees_biz_grant <- final_panel_wide %>%filter(mentee ==1, final_assignment !="control") %>%group_by(final_assignment) %>%pivot_longer(cols =starts_with("distance_to_bizgrant_"), names_to ="round",values_to ="distance_to_bizgrant") %>%mutate(round =factor(round, levels =c("distance_to_bizgrant_reg", "distance_to_bizgrant_base","distance_to_bizgrant_fu1", "distance_to_bizgrant_mid3", "distance_to_bizgrant_mid6","distance_to_bizgrant_end9")))
Code
# Plot the boxplotexposure_mentees_biz_grant %>%mutate(final_assignment =ifelse(final_assignment =="bc", "Business Content",ifelse(final_assignment =="pg", "Perspective Sharing", ifelse(final_assignment =="cash", "Cash", final_assignment)))) %>%ggplot(aes(x = round, y = distance_to_bizgrant, color = final_assignment)) +geom_boxplot() +coord_flip() +labs(x ="Round", y ="Distance to business grant (in days)",title ="Range of distance to business grant over time (Mentees)", subtitle ="Each round's distance to business grant") +geom_hline(yintercept =0, linetype ="dashed", color ="red") +scale_x_discrete(labels =c("Registration","Baseline", "Follow-up 1", "Midline 3", "Midline 6", "Endline 9")) +theme_minimal() +theme(axis.text.x =element_text(angle =45, hjust =1)) # Rotate x-axis labels